﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using com.hyrentals.webcommon.filter;
using com.hyrentals.webcommon.api;
using com.hyrentals.logic;
using com.hyrentals.data;
using com.hyrentals.webportal.Models;

namespace com.hyrentals.webportal.Controllers
{
    [CustomAuthorize]
    //[OnError(ComponentType.Member)]
    public class MemberController : BaseController
    {
        private RVLogic _RVLogic = new RVLogic();
        private RentalRequestLogic _rentalRequestLogic = new RentalRequestLogic();

        [ChildActionOnly]
        public ActionResult Nav(MemberNavType navType)
        {
            return View("w_Nav", navType);
        }

        [HttpGet]
        public ActionResult Inbox()
        {
            return View();
        }

        [HttpGet]
        public ActionResult MyRVs()
        {
            IEnumerable<RV> RVs = _RVLogic.GetRVByOwnerId(User.Identity.Name);

            return View("MyRVs", RVs);
        }

        [HttpGet]
        public ActionResult MyReservations()
        {
            IEnumerable<RentalRequest> rentalRequests = _rentalRequestLogic.GetReservationsByUserId(User.Identity.Name);
            return View("MyReservations", rentalRequests);
        }

        [HttpGet]
        public ActionResult MyTrips()
        {
            IEnumerable<RentalRequest> rentalRequests = _rentalRequestLogic.GetTripsByUserId(User.Identity.Name);
            return View("MyTrips", rentalRequests);
        }
    }
}
